3c283e15847a8dd61bfd6be4b2f672e32513fcd4,packaging/src/functionaltest/java/org/neo4j/server/rest/IndexNodeFunctionalityTest.java,IndexNodeFunctionalityTest,shouldGet200AndArrayOfNodeRepsWhenGettingFromIndex,#,167
Before Change
MediaType.APPLICATION_JSON ).post( ClientResponse.class );
assertEquals( 201, responseToPost.getStatus() );
String location2 = responseToPost.getHeaders().getFirst( HttpHeaders.LOCATION );
responseToPost = Client.create().resource( functionalTestHelper.nodeIndexUri() + indexName + "/" + key + "/" + value )
.entity( JsonHelper.createJsonFrom( location1 ), MediaType.APPLICATION_JSON )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
assertEquals( 201, responseToPost.getStatus() );
String indexLocation1 = responseToPost.getHeaders().getFirst( HttpHeaders.LOCATION );
responseToPost = Client.create().resource( functionalTestHelper.nodeIndexUri() + indexName + "/" + key + "/" + value )
.entity( JsonHelper.createJsonFrom( location2 ), MediaType.APPLICATION_JSON )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
assertEquals( 201, responseToPost.getStatus() );
String indexLocation2 = responseToPost.getHeaders().getFirst( HttpHeaders.LOCATION );
Map<String, String> uriToName = new HashMap<String, String>();
uriToName.put( indexLocation1.toString(), name1 );
uriToName.put( indexLocation2.toString(), name2 );
ClientResponse response = Client.create().resource( functionalTestHelper.nodeIndexUri() + indexName + "/" + key + "/" + value ).accept( MediaType.APPLICATION_JSON )
.get( ClientResponse.class );
assertEquals( 200, response.getStatus() );
Collection<?> items = (Collection<?>) JsonHelper.jsonToSingleValue( response.getEntity( String.class ) );
int counter = 0;
After Change
String name1 = "Thomas Anderson";
String name2 = "Agent Smith";
String indexName = "matrix";
ClientResponse responseToPost = Client.create().resource( functionalTestHelper.nodeUri() )
.accept( MediaType.APPLICATION_JSON )
.entity( "{\"name\":\"" + name1 + "\"}", MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
assertEquals( 201, responseToPost.getStatus() );
String location1 = responseToPost.getHeaders().getFirst( HttpHeaders.LOCATION );
responseToPost = Client.create().resource( functionalTestHelper.nodeUri() ).accept( MediaType.APPLICATION_JSON ).entity( "{\"name\":\"" + name2 + "\"}",
MediaType.APPLICATION_JSON ).post( ClientResponse.class );
assertEquals( 201, responseToPost.getStatus() );
String location2 = responseToPost.getHeaders().getFirst( HttpHeaders.LOCATION );
responseToPost = Client.create().resource( functionalTestHelper.indexNodeUri( indexName, key, value ) )
.entity( JsonHelper.createJsonFrom( location1 ), MediaType.APPLICATION_JSON )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
assertEquals( 201, responseToPost.getStatus() );
String indexLocation1 = responseToPost.getHeaders().getFirst( HttpHeaders.LOCATION );
responseToPost = Client.create().resource( functionalTestHelper.indexNodeUri( indexName, key, value ) )
.entity( JsonHelper.createJsonFrom( location2 ), MediaType.APPLICATION_JSON )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
assertEquals( 201, responseToPost.getStatus() );
String indexLocation2 = responseToPost.getHeaders().getFirst( HttpHeaders.LOCATION );
Map<String, String> uriToName = new HashMap<String, String>();
uriToName.put( indexLocation1.toString(), name1 );
uriToName.put( indexLocation2.toString(), name2 );
ClientResponse response = Client.create().resource( functionalTestHelper.indexNodeUri( indexName, key, value ) ).accept( MediaType.APPLICATION_JSON )
.get( ClientResponse.class );
assertEquals( 200, response.getStatus() );
Collection<?> items = (Collection<?>) JsonHelper.jsonToSingleValue( response.getEntity( String.class ) );
int counter = 0;